<?php
/**
 * Created by PhpStorm.
 * User: hantian
 * Date: 2017/9/28
 * Time: 下午5:28
 */

namespace App\Services;

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;


final class AuthCheckService
{
    public static function checkIsSelf($user_id)
    {
        return $user_id == Auth::id();
    }

    public static function checkOrgPermission($organization_id)
    {
        $user_id = Auth::id();
        $res = DB::table('gt_organization_member')
            ->where(['user_id' => $user_id, 'organization_id' => $organization_id])
            ->count();
        return $res > 0;
    }
}